/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package GraphsWindowPackage;

import javafx.scene.shape.Shape;
import javafx.scene.Node;
import javafx.scene.Group;
import javafx.scene.input.MouseEvent;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import AlertSystem.Window;
import javafx.stage.StageStyle;
import javafx.scene.paint.Color;

/**
 * @author quang
 */

public class LabMedNode extends Window {
    public var shape: Shape = null;
    public var info: String;
    
    public override function create(): Node {        
        var stage: Stage = null;
        return Group {
            content: shape
            onMouseEntered: function(e: MouseEvent): Void {
                shape.scaleY = 1.5;
                stage = Stage {
                    onClose: function () { shape.scaleY = 1.0; stage = null; }
                    x: e.screenX - (nameWidth + groupLevelXOffset)
                    y: e.screenY - 40
                    style: StageStyle.UNDECORATED
                    scene: Scene {
                        fill: Color.YELLOW
                        content: [
                            Text {
                                content: "\n{info}"
                                wrappingWidth: nameWidth + groupLevelXOffset - 10
                            }
                        ]
                    }
                }
            }
            onMouseExited: function(e: MouseEvent): Void {
                stage.close();
            }
        };
    }

}
